package com.binarysnobbery.ymmv.client;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;

import com.google.appengine.api.users.User;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class MileageEntry {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	@Persistent
	private User user;
		
	//private double odometerReading;
	@Persistent
	private double miles;
	@Persistent
	private double gallons;
	@Persistent
	private Date date;
	
	public MileageEntry() {	
	}

	public MileageEntry(User user, Date date, double gallons,
			double miles) {
		super();
		this.user = user;
		this.date = date;
		this.gallons = gallons;
		this.miles = miles;
	}

	public long getId() {
		return id;
	}
	
	public User getUser() {
		return user;
	}
	
	public void setUser(User user) {
		this.user = user;
	}
	
	public double getMiles() {
		return miles;
	}

	public void setMiles(double miles) {
		this.miles = miles;
	}

	public double getGallons() {
		return gallons;
	}

	public void setGallons(double gallonsPumped) {
		this.gallons = gallonsPumped;
	}

	public double getMilesPerGallon() {
		return miles / gallons;
	}

	public Date getDate() {
		return date;
	}
	
	
}
